<div class="panel panel-default panel-intro">

    <div class="panel-heading">
        {:__('Info')}
    </div>
    {if condition="$detail neq null "}

    <div class="panel-body newrow prindBody">
        <div class="row">
            <div class="col-md-4 col-xs-6 form-group code">
                <label class="control-label col-xs-12 col-sm-3">{:__('Code')}:</label>
                <div class="col-xs-12 col-sm-6">
                    {$detail[0]['code']}
                </div>
            </div>
            <div class="col-md-4 col-xs-6 form-group print-row">
                <label class="control-label col-xs-12 col-sm-3">{:__('Supplier')}:</label>
                <div class="col-xs-12 col-sm-6">
                    {$detail[0]['supplier']['name']}
                </div>
            </div>
            <div class="col-md-4 col-xs-6 form-group print-row">
                <label class="control-label col-xs-12 col-sm-3">{:__('Billing')}:</label>
                <div class="col-xs-12 col-sm-6">
                    {$detail[0]['billing_time']|date="Y-m-d",###}
                </div>
            </div>
            <div class="col-md-4 col-xs-6 form-group print-remark">
                <label class="control-label col-xs-12 col-sm-3">{:__('Remark')}:</label>
                <div class="col-xs-12 col-sm-6">
                    {$detail[0]['remark']}
                </div>
            </div>
            {if condition="$detail[0]['status'] eq 2"}
            <div class="col-md-12 col-xs-6 form-group print-remark">
                <label class="control-label col-xs-12 col-sm-1" style="color: red">{:__('Reason for failure')}:</label>
                <div class="col-xs-12 col-sm-11">
                    {$detail[0]['reason']}
                </div>
            </div>
            {/if}
        </div>
        <div class="table-responsive">
            <table class="table table-striped">
                <tr>
                    <th>{:__('Serial number')}</th>
                    <th>{:__('Sku')}</th>
                    <th>{:__('Commodity')}</th>     
                    <th>{:__('Specification')}</th>
                    <th>{:__('Attributes')}</th>
                    <th>{:__('Unit')}</th>
                    <th>{:__('nums')}</th>
                    <th>{:__('unit price')}</th>
                    <th>{:__('Subtotal')}</th>
                    <th>{:__('Remarks')}</th>
                </tr>
                {if condition="$product neq null"}
                {volist name="product" id="vo" key="k"}
                <tr>
                    <td>{$k}</td>
                    <td>{$vo.products['sku']}</td>
                    <td>{$vo.products['name']}</td>
                    <td>{$vo.products['specification']}</td>
                    <td>
                        {volist name="$vo.products['prop']" id="val"}
                        {$val.title}:{:isset($val['value'])?$val['value']:""}
                        {/volist}
                    </td>
                    <td>{$vo.products.unit}</td>
                    <td>{$vo.nums}</td>
                    <td>{$vo.price}</td>
                    <td>{$vo.subtotal}</td>
                    <td>{$vo.remark}</td>
                </tr>
                {/volist}
                {/if}
                <tr>
                    <td>总计</td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>{$detail[0]['totalnums']}</td>
                    <td></td>
                    <td>{$detail[0]['money']}</td>
                    <td></td>
                </tr>

            </table>
        </div>
        <div style="padding-top: 20px;" class="no-print">
            <div class="row">
                <div  class="control-label col-xs-12 col-sm-12">

                </div>
            </div>
        </div>
    </div>
    <div class="row btnGroups">
        <div  class="col-md-12 col-xs-12 form-group" style="text-align: right;">
            {if condition="$detail[0]['status'] eq 0"}
            <a class="btn btn-default" href="{:url('/ykjp/purchase/retire/edit',array('ids'=>$detail[0]['id']))}" role="button">{:__('Edit')}</a>
            <a class="btn btn-default {:$auth->check('ykjp/purchase/ret_review/reviewRet')?'':'hide'}" onclick="approval('yes', {$detail[0]['id']})"   role="button">{:__('examination passed')}</a>
            <a class="btn btn-default {:$auth->check('ykjp/purchase/ret_review/reviewRet')?'':'hide'}" onclick="appWhy({$detail[0]['id']})"  role="button">{:__('not approved')}</a>
            {/if}
            {if condition="$detail[0]['status'] eq 1"}
            <a class="btn btn-default {:$auth->check('ykjp/purchase/retire/confirm')?'':'hide'}" onclick="confirmYes({$detail[0]['id']})"  role="button">{:__('Successful return')}</a>
            <a class="btn btn-default {:$auth->check('ykjp/purchase/retire/confirm')?'':'hide'}"   data-toggle="modal" data-target="#myModal"  role="button">{:__('Return failed')}</a>
            {/if}

            {if condition="$detail[0]['status'] eq 1 or $detail[0]['status'] eq 2 "}
            <a class="btn btn-default {:$auth->check('ykjp/purchase/retire/Anti')?'':'hide'}"   onclick="Anti({$detail[0]['id']})"  role="button">{:__('Anti audit')}</a>
            {/if}

        </div>
    </div>
</div>
</div>


<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">{:__('reason of failure')}</h4>
            </div>
            <div class="modal-body">

                <textarea id="why" placeholder="{:__('Please fill in the reason for the failure, can be empty')}" class="form-control" rows="3"></textarea>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">{:__('Close')}</button>
                <button type="button" class="btn btn-primary" onclick="confirmNo({$detail[0]['id']})">{:__('Save changes')}</button>
            </div>
        </div>
    </div>
</div>

{/if}
